package com.yjh.gateway.controller;

import cn.hutool.json.JSONArray;
import com.yjh.gateway.service.SysRouteConfService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import util.R;


/**
 * 路由
 *

 */
@RestController
@AllArgsConstructor
@RequestMapping("/route")
//@Api(value = "route",description = "动态路由管理模块")
public class SysRouteConfController {
    private final SysRouteConfService sysRouteConfService;

    /**
     * 获取当前定义的路由信息
     *
     * @return
     */
    @GetMapping("/getRoutes")
    public R listRoutes() {
        return new R<>(sysRouteConfService.routes());
    }

    /**
     * 修改路由
     *
     * @param routes 路由定义
     * @return
     */
//	@SysLog("修改路由")
    @PostMapping
    public R updateRoutes(@RequestBody JSONArray routes) {
        return new R(sysRouteConfService.updateRoutes(routes));
    }

}
